﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.LiveFX.ResourceModel;
using Microsoft.LiveFX.Client;

namespace LiveFrameworkExplorer.Plugins
{
    public partial class dlgAddInvitation : Form
    {
        public string ContactLiveID
        {
            get
            {
                return cbContacts.Text;
            }
        }
        public RoleType? RoleType
        {
            get
            {
                try
                {
                    return (RoleType)Enum.Parse(typeof(RoleType), (string)cbRole.SelectedItem);
                }
                catch { return null; }
            }
        }
        public bool IsOwner
        {
            get
            {
                return cbIsOwner.Checked;
            }
        }

        public dlgAddInvitation(IEnumerable<String> contactsList)
        {
            InitializeComponent();
            cbContacts.Items.AddRange(contactsList.ToArray());
            foreach (var role in Enum.GetNames(typeof(RoleType)))
            {
                cbRole.Items.Add(role);
            }
        }

        private void btOK_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.ContactLiveID) && this.RoleType.HasValue)
                this.DialogResult = DialogResult.OK;
            else
                MessageBox.Show("Windows Live ID or Role is missing !", "Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
}
